$(function(){
	var loadPath = $("#loadPath").val();
	//加载主页
	$('#page-content-main').load(loadPath+"/init/main");
	
	//点击顶部主菜单
	$(".top-menu-icon").click(function(){
		var id = $(this).attr("data-id");
		var url = $(this).attr("data-url");
		$('#page-content-left').load(loadPath+"/menu/toChildrenMenu?id="+id);
		$('#page-content-main').load(loadPath+url);
		$('#page-content-main').removeClass("page-content-margin");
		$('#page-content-main').addClass("page-content-margin-cancel");
	});
	
	//加载工作台左侧菜单
	$("#myWorkbench").click(function(){
		$('#page-content-left').load(loadPath+"/init/toWorkbenchleft");
		$('#page-content-main').load(loadPath+"/init/toworkbenchcontent");
		$('#page-content-main').removeClass("page-content-margin");
		$('#page-content-main').addClass("page-content-margin-cancel");
	});
	
	//显示主页
	$("#content-main").click(function(){
		$('#page-content-main').addClass("page-content-margin");
		$('#page-content-main').removeClass("page-content-margin-cancel");
		$('#page-content-left').empty();
		$('#page-content-main').load(loadPath+"/init/main");
		
	});
	
	//点击左侧菜单请求
	$("#page-content-left").on("click",".left-menu",function(){
		var url = $(this).attr("data-url");
		if(url) $('#page-content-main').load(loadPath+url);
	});
});